Skip to content

be: tell when a token expires, so a merchant can be asked for a new one before it stops working - #71

Merged
landsman merged 4 commits into
mainfrom
be/token-expiry
Nov 12, 2026
Merged

landsman merged 4 commits into
mainfrom
be/token-expiry

Conversation

@landsman

Copy link
Copy Markdown
Owner

A merchant's token expires, and until now an app found out from a 401 when payments stopped arriving. `client.tokenExpiry(token)` (and `me.tokenExpiry()`) reads it from `GET /api/v1/vip/token/introspect`, MONETA's `VipTokenIntrospect_v1`, so the app can ask for a new token in time.

A 403, which MONETA sends for a token that is not a MONETA API token, is `InvalidToken` like any refused token; an answer without `expiration` is `InvalidResponse`. The endpoint gets its own `uriTemplate` for metrics.

Checked live with `make peek-token`, added here: a merchant token issued in November 2026 answered `2027-02-08T17:25:00Z`.

@landsman landsman left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shape is right: one call, a 403 already lands in InvalidToken through the existing case 401, 403, the template is registered for metrics, and the reachability metadata picks up the new record by itself. CI is green.

One thing worth doing before merge (the native caller), one typo, one nit.

Comment thread .docs/usage.md Resolved

@landsman landsman left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second round: all three points are in. NativeCaller now reads the token's expiry, so the native image check proves the OffsetDateTime binding the JVM test already did, and native image is green on 85283f7. Nothing blocking left; two nits below, both fine to skip.

@landsman
landsman merged commit 9e08960 into main Nov 12, 2026
6 checks passed
@landsman
landsman deleted the be/token-expiry branch November 12, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant